package org.agile2soft.nexoma.core.dao.hibernate;

import org.agile2soft.nexoma.core.dao.InternalUserDAO;
import org.agile2soft.nexoma.core.entity.InternalUser;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;


import br.com.arsmachina.dao.hibernate.GenericDAOImpl;

public class InternalUserDAOImpl extends GenericDAOImpl <InternalUser,String> implements InternalUserDAO{

    public InternalUserDAOImpl(SessionFactory sessionFactory) {
        super(sessionFactory);
    }

    public InternalUser findByDocNumber(String documentNumber) {
        Criteria criteria = createCriteria();
        criteria.add(Restrictions.eq("documentNumber", documentNumber));
        return (InternalUser)criteria.uniqueResult();
    }

}
